Intermediate / 1 to 5 years experienced level questions
Intermediate / 1 to 5 years experienced level questions & answers
Ques 1. How do you create a new branch in Git?
You can create a new branch using the 'git branch' command followed by the branch name.
Ques 2. Explain the 'git merge' command.
The 'git merge' command combines changes from different branches into the current branch.
Ques 3. What is a Git conflict, and how can it be resolved?
A Git conflict occurs when changes in one branch cannot be merged automatically. It can be resolved by manually editing the conflicting files.
Ques 4. How do you undo the last Git commit?
You can use 'git reset HEAD~1' to undo the last commit without discarding the changes.
Ques 5. How do you revert a commit that has already been pushed and shared with others?
You can use 'git revert' to create a new commit that undoes the changes introduced by the previous commit.
Ques 6. What is a Git submodule?
A Git submodule is a reference to a specific commit in another repository within the current repository. It allows for better organization and management of project dependencies.
Ques 7. Explain the purpose of the 'git cherry-pick' command.
'git cherry-pick' is used to apply specific commits from one branch to another.
Ques 8. What is the difference between 'git fetch' and 'git pull'?
'git fetch' retrieves changes from a remote repository without merging them, while 'git pull' fetches and merges changes in one command.
Ques 9. What is the purpose of 'git remote'?
'git remote' is used to manage remote repositories. It allows you to add, remove, or view the configured remote repositories.
Ques 10. What is the purpose of the '.gitattributes' file?
The '.gitattributes' file is used to define attributes and merge strategies for specific files in a Git repository.
Ques 11. Explain the difference between 'git push' and 'git pull' commands.
'git push' is used to upload local changes to a remote repository, while 'git pull' is used to fetch and merge changes from a remote repository.
Most helpful rated by users: